#include <cstdio>
#include <cmath>

int euler_phi(int n){
	int e = n;
	for (int i = 2; i*i <= n; i++) {
		if(!(n % i)) e -= e / i;
		while(!(n % i)) n /= i;
	}
	if (n > 1) e -=  e / n;
	return e;
}

int main() {
	int k;
	while (scanf("%d", &k) != EOF) {
		printf("%d\n", euler_phi(k));
	}
	return 0;
}
